<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotDatajson extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdPILOTDATAJSON;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_DATALOADED;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_PILOTPROJETANALYSEIdPILOTPROJETANALYSE;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_PILOTLOADPLANIdPILOTLOADPLAN1;


    /**
     * Parent relation fk_PILOT_DATAJSON_PILOT_PROJETANALYSE1
     *
     * @var Application_Model_PilotProjetanalyse
     */
    protected $_PilotProjetanalyse;

    /**
     * Parent relation fk_PILOT_DATAJSON_PILOT_LOADPLAN1
     *
     * @var Application_Model_PilotLoadplan
     */
    protected $_PilotLoadplan;


    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_DATAJSON'=>'IdPILOTDATAJSON',
            'DATALOADED'=>'DATALOADED',
            'PILOT_PROJETANALYSE_idPILOT_PROJETANALYSE'=>'PILOTPROJETANALYSEIdPILOTPROJETANALYSE',
            'PILOT_LOADPLAN_idPILOT_LOADPLAN1'=>'PILOTLOADPLANIdPILOTLOADPLAN1',
        ));

        $this->setParentList(array(
            'FkPILOTDATAJSONPILOTPROJETANALYSE1'=> array(
                    'property' => 'PilotProjetanalyse',
                    'table_name' => 'PilotProjetanalyse',
                ),
            'FkPILOTDATAJSONPILOTLOADPLAN1'=> array(
                    'property' => 'PilotLoadplan',
                    'table_name' => 'PilotLoadplan',
                ),
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column idPILOT_DATAJSON
     *
     * @param int $data
     * @return Application_Model_PilotDatajson
     */
    public function setIdPILOTDATAJSON($data)
    {
        $this->_IdPILOTDATAJSON = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_DATAJSON
     *
     * @return int
     */
    public function getIdPILOTDATAJSON()
    {
        return $this->_IdPILOTDATAJSON;
    }

    /**
     * Sets column DATALOADED
     *
     * @param text $data
     * @return Application_Model_PilotDatajson
     */
    public function setDATALOADED($data)
    {
        $this->_DATALOADED = $data;
        return $this;
    }

    /**
     * Gets column DATALOADED
     *
     * @return text
     */
    public function getDATALOADED()
    {
        return $this->_DATALOADED;
    }

    /**
     * Sets column PILOT_PROJETANALYSE_idPILOT_PROJETANALYSE
     *
     * @param int $data
     * @return Application_Model_PilotDatajson
     */
    public function setPILOTPROJETANALYSEIdPILOTPROJETANALYSE($data)
    {
        $this->_PILOTPROJETANALYSEIdPILOTPROJETANALYSE = $data;
        return $this;
    }

    /**
     * Gets column PILOT_PROJETANALYSE_idPILOT_PROJETANALYSE
     *
     * @return int
     */
    public function getPILOTPROJETANALYSEIdPILOTPROJETANALYSE()
    {
        return $this->_PILOTPROJETANALYSEIdPILOTPROJETANALYSE;
    }

    /**
     * Sets column PILOT_LOADPLAN_idPILOT_LOADPLAN1
     *
     * @param int $data
     * @return Application_Model_PilotDatajson
     */
    public function setPILOTLOADPLANIdPILOTLOADPLAN1($data)
    {
        $this->_PILOTLOADPLANIdPILOTLOADPLAN1 = $data;
        return $this;
    }

    /**
     * Gets column PILOT_LOADPLAN_idPILOT_LOADPLAN1
     *
     * @return int
     */
    public function getPILOTLOADPLANIdPILOTLOADPLAN1()
    {
        return $this->_PILOTLOADPLANIdPILOTLOADPLAN1;
    }

    /**
     * Sets parent relation PILOTPROJETANALYSEIdPILOTPROJETANALYSE
     *
     * @param Application_Model_PilotProjetanalyse $data
     * @return Application_Model_PilotDatajson
     */
    public function setPilotProjetanalyse(Application_Model_PilotProjetanalyse $data)
    {
        $this->_PilotProjetanalyse = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_PROJETANALYSE'];
        }

        $this->setPILOTPROJETANALYSEIdPILOTPROJETANALYSE($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTPROJETANALYSEIdPILOTPROJETANALYSE
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotProjetanalyse
     */
    public function getPilotProjetanalyse($load = true)
    {
        if ($this->_PilotProjetanalyse === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDATAJSONPILOTPROJETANALYSE1', $this);
        }

        return $this->_PilotProjetanalyse;
    }

    /**
     * Sets parent relation PILOTLOADPLANIdPILOTLOADPLAN1
     *
     * @param Application_Model_PilotLoadplan $data
     * @return Application_Model_PilotDatajson
     */
    public function setPilotLoadplan(Application_Model_PilotLoadplan $data)
    {
        $this->_PilotLoadplan = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_LOADPLAN'];
        }

        $this->setPILOTLOADPLANIdPILOTLOADPLAN1($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTLOADPLANIdPILOTLOADPLAN1
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotLoadplan
     */
    public function getPilotLoadplan($load = true)
    {
        if ($this->_PilotLoadplan === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDATAJSONPILOTLOADPLAN1', $this);
        }

        return $this->_PilotLoadplan;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotDatajson
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotDatajson());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotDatajson::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTDATAJSON() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_DATAJSON = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTDATAJSON()));
    }
}
